Replication files for "Fiscal Multipliers and Financial Crises", conditionally accepted in the Review of Economics and Statistics.

Author: Miguel Faria-e-Castro, Federal Reserve Bank of St. Louis, miguel.fariaecastro@stls.frb.org


******************************************
*** ACKNOWLEDGEMENTS AND PRELIMINARIES ***
******************************************

This work has benefited from computing resources provided by the CADRE group at the Federal Reserve Bank of Kansas City, more specifically the BEAR cluster.
For a full list of acknowledgments, please see the published paper or its working paper version.

All Stata code was tested and run on Stata 16.1, on a personal laptop running Windows 10 Enterprise. 
All MATLAB code was tested and run on MATLAB 2019a on a HPC running Linux.
All MATLAB code was also tested and run on MATLAB R2019b on a personal laptop running Windows 10 Enterprise.

The main paper results were obtained in a HPC, using a single-node with 32 cores.
I have included the BASH files used to run the code in the HPC cluster for reference.  


************
*** DATA ***
************

All data that is loaded by the program to generate the results is contained in full_data.csv. Copies of this file are found inside of the folders `fiscal_policy_estimation' and all folders whose names start with `all_*'
Running stata/paper_plots.do `plots/stimulus_GTb_xk_sd', which is panel (a) of *Figure 2*.



***************************
*** CODE FOR MAIN PAPER ***
***************************

From here onwards we will be working within the MATLAB folder.
Due to the complexity of the model, I adopted the following procedure that starts from a model with no fiscal policy (5 state variables) and progressively adds fiscal policies until the final version with 11 state variables is solve. The instructions to reproduce the results in the paper are as follows:

1. Start by solving the model in the folder `main'. This is the model without fiscal policy. The main file for the code is `main_file.m'. Make sure that on line 21, config.guess is set to 0 the first time you solve the model. It will run time iteration for a number of iterations equal to config.maxiter as specified in line 20. To get reasonable convergence, you may have to run this file multiple times, each time reusing the guess from the past iteration (make sure you set config.guess=1 so the new run uses the previous guess).

1.a. This will generate *Figure 1* in the paper, in `results/paper_crisis_alt_state2.eps'
1.b. This will generate *Figure A.1* in `results/paper_tfp_slides.eps'
1.c. This will generate *Figure A.2* in `results/euler_eq_residuals_C.eps'

2. Move the resulting `main/results/model_output.mat' to the folder `fiscal_policy_estimation' and run `fp_estimation.m'. This will estimate the size of the fiscal policy impulses, their persistence, and the persistence parameters for the government's recapitalization and guarantee policies (theta^k and theta^d). 

2.a. This will generate *Figure A.6* in `discretized_policies_fdic.eps'

3. Move the resulting `guess.mat' to the folder `tb' and run `main_file.m' to solve the model with transfers and calibrate chi/beta_b. Make sure that config.guess=0 and config.simpleguess=1 the first time you run it, as then it will use the guess from `main' instead of simply starting from the deterministic steady state.

4. Move the `guess.mat' to the folder `noxd' and run `main_file.m' to solve the model with all fiscal policies except guarantees. Make sure that config.guess=0 and config.simpleguess=1 the first time you run it, as then it will use the guess from `main' instead of simply starting from the deterministic steady state.

5. Move the `guess.mat' to the folder `all_original_grid' and run `main_file.m' to solve the model with all fiscal policies and run the particle filter. Make sure that config.guess=0 and config.simpleguess=1 the first time you run it, as then it will use the guess from `main' instead of simply starting from the deterministic steady state. Again, you may have to do multiple iterations (this time with config.guess=1 to reuse the previous guess) to get the model to converge to an acceptable tolerance. 
Note that at the end of a run, this will run the particle filter as well as all the counterfactual exercises. This will generate the remaining figures and results in the paper. 

5.a. This generates panel (b) of *Figure 2* in `all_original_grid/filter_dual/figures/smoothed_shocks.eps'
5.b. This generates all panels of *Figure 3* in `all_original_grid/filter_dual/figures/smoothed_*.eps' with * = {consumption, defrate, spread, houseprices}
5.c. This generates all panels of *Figure 4* in `all_original_grid/filter_dual/figures/*.eps' with * = {nopol_counterfactual_cbcs, cf_decomp_aggcons}
5.d. This generates *Figure 5* in `all_original_grid/filter_dual/figures/ts_Ynetmultipliers.eps'
5.e. This code will also print a log file with the main results for the % of consumption drop in the counterfactual without policy vs. the actual drop. 
5.f. This will generate *Figures A.3-A.5* in `all_original_grid/figures/irf_*.eps' for * = {tbcrisis, xkcrisis, xdcrisis}
5.g. This will generate *Figure A.8* in `all_original_grid/filter_dual/figures/distr_Ynetmultipliers_ci.eps' 
5.h. This will generate *Figure A.10* in `all_original_grid/filter_dual/figures/data_plot.eps' 
5.i. This will generate *Figure A.11* in `all_original_grid/filter_dual/figures/smoothed_multipliers.eps' 



***************************************
*** APPENDIX RESULTS AND ROBUSTNESS ***
***************************************

Description of other folders:
1. "all_endopol" is the model extension where policy rules depend on the state of the economy
2. "all_pers75", "all_pers95" are robustness exercises with respect to different parametrizations of the crisis shock persistence
3. "all_phitau10" is a robustness exercise with respect to different parametrizations of the tax rule
4. "all_taylor_pi2", "all_taylor_pi5", "all_taylor_y_hi", "all_taylor_y_lo" are robustness exercises with respect to different parametrizations of the Taylor Rule
5. "all_transfboth" is a version of the model where savers also receive transfers
6. "fiscal_policy_estimation" estimates the fiscal policy parameters of the model given a model solution file from "main"
7. "tables" stores tables created by the .m files in the main folder

To generate the remaining results in the appendix:
1. Running the code in `all_transfboth' will generate Figure A.7
2. Running the code in `all_endopol' followed by `tables_moral_hazard.m' will generate *Table A.1* inside the folder `tables'
3. Running the code in `all_phitau10' followed by `tables_phitau' generates *Table A.2* inside the folder `tables'
4. Running the code in "all_taylor_pi2", "all_taylor_pi5", "all_taylor_y_hi", "all_taylor_y_lo", followed by `tables_taylor_rule' generates *Table A.3* inside the folder `tables'